home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 15685 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.9 KB  |  46 lines

  1. Newsgroups: comp.lang.c++
  2. Path: news.csug.rochester.edu!rit!atd
  3. From: atd@cs.rit.edu (Albert T Davis)
  4. Subject: Re: FORTRAN vs C++ BENCHMARKS  ???
  5. Message-ID: <1996Apr7.235903.23056@cs.rit.edu>
  6. Sender: news@cs.rit.edu (USENET News Admin)
  7. Nntp-Posting-Host: athens
  8. Organization: Rochester Institute of Technology, Rochester, NY
  9. References: <4k7q4q$48h@nntp.Stanford.EDU>
  10. Date: Sun, 7 Apr 1996 23:59:03 GMT
  11.  
  12. In article <4k7q4q$48h@nntp.Stanford.EDU> tjb <byer@pangea.stanford.edu> writes:
  13. >Anyone know if there are any performance comparisons of FORTRAN vs C++ in 
  14. >numerically intensive applications.  I'm interested in benchmarks done on 
  15. >RISC machines.  
  16.  
  17. There are lots of them, that generally show that Fortran is faster by
  18. some trivial amount.
  19.  
  20. The common benchmark consists of a chunk of code written in a common
  21. subset of all languages.  In other words, the benchmark is carefully
  22. chosen to give Fortran an advantage.
  23.  
  24. A more reasonable benchmark would use DIFFERENT programs in both
  25. languages, both written to take best advantage of the best features of
  26. the language.
  27.  
  28. As an example, a common benchmark is LU decomposition if a dense
  29. matrix of fixed size, using BLAS or a translation of it.  The
  30. benchmark also shows the "problem" C or C++ has in passing arrays into
  31. functions.  
  32.  
  33. A better benchmark would be a SPARSE matrix, perhaps with a density of
  34. about 1%.  Maybe a bump-and-spike matrix or something like that.
  35. Compare for speed, ease of programming, code readability.  With a test
  36. like this, C++ will win.
  37.  
  38. Carrying this on, in real numerically intensive applications, there is
  39. a need for real data structures (stacks, linked lists, ...)  Trying to
  40. do this part in Fortran will cost much more, and will offset the small
  41. gain you might get due to a little better optimization.
  42.  
  43. The biggest problem with C++ (as far as efficiency is concerned) is
  44. that it is so easy for poor design to hide lots of inefficiency, then
  45. blame it on the language.
  46.